home *** CD-ROM | disk | FTP | other *** search
- Path: news.dfci.harvard.edu!gotd
- From: gotd@jimmy.harvard.edu (Godfrey Degamo)
- Newsgroups: comp.lang.c
- Subject: H&S <=> K&R
- Date: 7 Mar 1996 21:12:57 GMT
- Organization: Dana-Farber Cancer Institute
- Message-ID: <4hnjgp$brj@cisunix1.dfci.harvard.edu>
- NNTP-Posting-Host: occams.dfci.harvard.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- Hello readers.
-
- I have a really silly question/observation, which I'm hoping
- you can answer/verify.
-
- First, my H&S 4th edition mentions nothing (I think) on
- fflush with argument NULL. However, my ANSI K&R book clearly states
- that fflush( NULL) flushes all output stream. My K&R book is
- copyright 1988, my H&S book is copyright 1995. So, has this
- feature of ANSI C changed? (Or am I just overlooking something?)
-
-
- Second, my K&R book clearly states that the scanf conversions,
- [...], and [^...] matches a *non-empty* string. Whereas my H&S book
- does not. (I don't think it implies it... but I'm not sure...)
-
- Thus according to K&R the following will happen?
- char buf1[] = "blahblah:123212";
- char buf2[] = ":2313";
-
-
- sscanf( buf1, "%[^:]:%s", s1, s2); /* OK in K&R and H&S */
- sscanf( buf2, "%[^:]:%s", s1, s2); /* Error in K&R, but H&S?????? */
-
-
- Perhaps I'm reading both books wrong, in which case, I've made
- an ass out of myself! Anyways, if you can clear up my confusion,
- that would be great. Once again, sorry for my silly question,
- but thanks for your time.
-
- -Godfrey Degamo,
- gotd@jimmy.harvard.edu
-